Skip to content

feat(ui): close the mobile story list when a story is selected - #968

Open
officialasishkumar wants to merge 1 commit into
storybookjs:nextfrom
officialasishkumar:feat/close-menu-on-story-select
Open

officialasishkumar wants to merge 1 commit into
storybookjs:nextfrom
officialasishkumar:feat/close-menu-on-story-select

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

Issue: #924

What I did

On phones the story list is a bottom sheet, and choosing a story left it open on top of the story, so you had to swipe it away every time to see what you picked. Storybook for the web closes its mobile navigation when you choose a story (api.setMobileNavigation(false) in the sidebar Tree), so this does the same on device.

Changes:

  • Layout's setSelection closes the mobile drawer after emitting SET_CURRENT_STORY, in both @storybook/react-native-ui and @storybook/react-native-ui-lite. Tree story rows and search results both call setSelection, so both close the list. Expanding or collapsing a group or component doesn't go through setSelection, so the list stays open while you browse. On desktop the drawer isn't rendered and the ref is empty, so nothing changes there.
  • Added Layout.test.tsx in @storybook/react-native-ui. It renders the layout, toggles a group and checks the drawer stays open, then selects a story and checks SET_CURRENT_STORY is emitted and the drawer is closed once. The test fails without the change. @storybook/react-native-ui-lite has no jest setup, so its one-line change isn't covered by a test.
  • Layout imports runtime values from storybook/internal/*, which ships as ESM, so storybook is added to transformIgnorePatterns in the react-native-ui jest config.
  • Changeset: patch for @storybook/react-native-ui and @storybook/react-native-ui-lite.

This is the same call the issue's patch-package diff adds, applied to the lite UI as well.

How to test

pnpm --filter @storybook/react-native-ui test

Manually, run examples/expo-example on a phone or phone simulator (pnpm example, or pnpm example:lite for the lite UI), open the story list from the bottom bar and pick a story. The list closes and the story is visible. Expanding or collapsing a group leaves the list open, and picking a story from search results closes it too. On a tablet-width or web desktop layout, the sidebar behaves as before.

  • Does this need a new example in examples/expo-example? No
  • Does this need an update to the documentation? No

Closes #924

On phones the story list lives in a bottom sheet drawer, and picking a
story left the drawer open on top of it, so every selection needed a
second gesture to dismiss the sheet before the story could be seen.
Storybook for the web closes its mobile navigation once a story is
chosen; do the same on device.

Layout's setSelection, which both the tree rows and the search results
call, now asks the mobile drawer to close after emitting
SET_CURRENT_STORY. Expanding or collapsing a group or component doesn't
go through setSelection, so the list stays open while browsing. On
desktop the drawer isn't rendered and the ref is empty, so nothing
changes there. The change is applied to both @storybook/react-native-ui
and @storybook/react-native-ui-lite.

Add a Layout test for @storybook/react-native-ui that toggles a group
(drawer stays open) and then selects a story (drawer is closed once).
Layout imports runtime values from storybook/internal, which ships ESM,
so let babel-jest transform the storybook package as well.

Closes storybookjs#924
@changeset-bot

changeset-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a436462

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@storybook/react-native-ui Patch
@storybook/react-native-ui-lite Patch
@storybook/addon-ondevice-actions Patch
@storybook/addon-ondevice-backgrounds Patch
@storybook/addon-ondevice-controls Patch
@storybook/addon-ondevice-notes Patch
@storybook/react-native-theming Patch
@storybook/react-native-ui-common Patch
@storybook/react-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-11T09:54:59.530742Z
We couldn’t complete this review. Comment @codex review to try again.
a436462 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@dannyhw

dannyhw commented Nov 11, 2026

Copy link
Copy Markdown
Member

honestly not sure where I stand on this one, I kinda like it working this way
though I'm open to making the option available I think part of the reason it doesn't feel good is that the lite-ui doesn't have the snap points that let you see the preview more easily

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Close Bottom Sheet When Story is Selected

2 participants